<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>authrealname账户</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/resource/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/resource/css/mylay.css">
</head>
<body>
    <div style="padding: 20px; background-color: #F2F2F2;">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card" style="padding: 10px;">
                    <form class="layui-form search">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">用户账号</label>
                                <div class="layui-input-inline">
                                    <input class="layui-input" name="username" >
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">UID</label>
                                <div class="layui-input-inline">
                                    <input class="layui-input" type="number" name="uid" >
                                </div>
                            </div>
                           
                            <div class="layui-inline">
                                    <label class="layui-form-label">状态</label>
                                    <div class="layui-input-inline">
                                        <select name="status" lay-search="">
                                            <option value="0">全部</option>
                                            {volist name="statusArr" id="vo" key="k" }
                                            <option value="{$k}">{$vo}</option>
                                            {/volist}
                                        </select>
                                    </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">添加时间</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="datetime_range" class="layui-input" readonly>
                                </div>
                            </div>
                            <div class="layui-inline" style="text-align: center;">
                                <button type="button" class="layui-btn" data-type="search">搜索</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

            <div class="layui-col-md12">
                <div class="layui-card">
                    <table class="layui-hide" id="authrealname" lay-filter="authrealname"></table>
                </div>
            </div>
        </div>
    </div>
    <!-- 头部左侧工具栏 -->
    <script type="text/html" id="toolbarDemo">
        <div class="layui-btn-container layui-btn-group">
            <button type="button" class="layui-btn layui-btn-sm" lay-event="authrealnameAdd">添加</button>
            <!-- <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="authrealnameAdd">添加收款账户</button> -->
        </div>
    </script>
    <!-- 表单元素 -->
    <!-- <script type="text/html" id="status">
        <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="开|关" lay-filter="authrealnameStatus" {{ d.status == 1 ? 'checked' : '' }}>
    </script> -->
  
    <script type="text/html" id="action">
        <div class="layui-btn-group">
            {{# if (d.status == '1') { }}
            <button type="button" class="layui-btn layui-btn-xs" lay-event="check">
                审核
             </button>
            {{# } }}

           
            <button type="button" class="layui-btn layui-btn-xs" lay-event="detail">
                详情
            </button>
            <button type="button" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">
                <i class="layui-icon">&#xe640;</i>
            </button>
        </div>
    </script>

<script src="/resource/layuiadmin/layui/layui.js"></script>
<script src="/resource/js/manage/init_date.js"></script>
<script src="/resource/js/manage/authrealname.js"></script>
<script>
    layui.use(['table'], function(){
        var $  = layui.$
        ,table = layui.table;

        //方法级渲染
        table.render({
            elem: '#authrealname'
            ,title: '收款账户'
            ,url: '/manage/authrealname/get_list'
            ,method: 'post'
            ,cols: [[
                {checkbox: true, fixed: true}
                ,{field: 'username', title: '用户'}
                ,{field: 'uid', title: 'UID'}
                ,{field: 'card_up_img', title: '身份证正面'}
                ,{field: 'card_down_img', title: '身份证反面'}
                ,{field: 'create_time', title: '添加时间', sort: true}
                ,{field: 'statusStr', title: '当前状态'}
                ,{title: '操作', width: '20%', toolbar: '#action'}
            ]]
            ,cellMinWidth: 100
            ,toolbar: '#toolbarDemo'
            ,defaultToolbar: ['filter', 'print', 'exports']
            ,totalRow: true
            ,page: {
                layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            }
            ,skin: 'row' //行边框风格
            ,even: true //开启隔行背景
        });

        //监听排序事件
        table.on('sort(authrealname)', function(obj){ //注：sort 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
            //尽管我们的 table 自带排序功能，但并没有请求服务端。
            //有些时候，你可能需要根据当前排序的字段，重新向服务端发送请求，从而实现服务端排序，如：
            table.reload('authrealname', {
                initSort: obj //记录初始排序，如果不设的话，将无法标记表头的排序状态。
                ,where: { //请求参数（注意：这里面的参数可任意定义，并非下面固定的格式）
                    sortField: obj.field //排序字段
                    ,sortType: obj.type //排序方式
                }
            });
        });

        active = {
            search: function(){
                //执行重载
                table.reload('authrealname', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    ,where: {
                        username: $("input[name='username']").val()
                        ,status: $("select[name='status'] option:selected").val()
                        ,name: $("input[name='name']").val()
                        ,uid: $("input[name='uid']").val()
                        ,datetime_range: $("input[name='datetime_range']").val()

                    }
                }, 'data');
            }
        };

        $('.search .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
</body>
</html>
